<template>
  <div class="pagestyle">
    <list_controller ref="zujianname" :options="state.options" :noprintDownShow="true">
      <template v-slot:opraCurdBtnlist="row">
        <span>
          <el-button class="tableFontSize" type="primary" link size="small" @click="lookBtn(row.row.row)">查看</el-button>
          <el-button class="tableFontSize" type="primary" link size="small" @click="editBtn(row.row.row)">编辑</el-button>
          <el-button class="tableFontSize" type="primary" link size="small" @click="deleteBtn(row.row.row)">删除
          </el-button>
        </span>
      </template>
      <template v-slot:opraCurdBtnAll>
         <!-- v-if="userStore.modify" -->
        <span :class="state.addModal ? 'listInfoBtn active' : 'listInfoBtn'"
          @click="addBtn('mul')">
          <svg-icon :class="state.addModal ? 'active' : ''" class-name="search-icon" icon-class="xinzeng" />
          新增
        </span>
        <span :class="'listInfoBtn'" @click="deleteBtn('mul')">
          <svg-icon class-name="search-icon" icon-class="shanchu" />
          删除
        </span>
      </template>
      <template v-slot:selectNamelist>
        工作面单元评价
      </template>
    </list_controller>
    <!-- 新增弹框 -->
    <teleport to="body">
      <vxe-modal esc-closable destroy-on-close :lock-view="false" :width="660" :height="auto" v-model="state.addModal"
        resize :mask="true" showFooter>
        <template #title>
          <div class="w100 h100 fsc mask_title">{{state.modalTitle}}</div>
        </template>
        <template #default>
          <div class="form_box">
            <el-form ref="formRef" :model="state.formData" :rules="state.rules" label-position="top">
              <el-row :gutter="20">
                <el-col :span="8">
                  <el-form-item label="工作面" prop="workingFaceId">
                    <el-select
                      v-model="state.formData.workingFaceId"
                      placeholder="请选择"
                      style="width: 100%"
                    >
                      <el-option
                        v-for="(item, index) in state.gongzuomianSelectData"
                        :key="index"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
                   <el-col :span="8">
                  <el-form-item label="评价单元名称" prop="name">
                    <el-input v-model="state.formData.name" placeholder="请输入"></el-input>
                  </el-form-item>
                </el-col>
                              <el-col :span="8">
                  <el-form-item label="评价开始时间" prop="evaluateStartTime">
                     <el-date-picker
                     placeholder="请选择时间"
                          v-model="state.formData.evaluateStartTime"
                          type="date"
                          size="small"
                          :value-format="'YYYY-MM-DD'"
                        />
                  </el-form-item>
                </el-col>
                 <el-col :span="8">
                  <el-form-item label="是否突出区域" prop="radioValue">
                    <el-radio-group v-model="state.formData.radioValue">
  <el-radio label="1">是</el-radio>
  <el-radio label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤壁暴露开始时间" prop="coalWallStartExposeTime">
                     <el-date-picker
                     placeholder="请选择时间"
                          v-model="state.formData.coalWallStartExposeTime"
                          type="date"
                          size="small"
                          :value-format="'YYYY-MM-DD'"
                        />
                  </el-form-item>
                </el-col>
                 <el-col :span="8">
                  <el-form-item label="吸附常数a" prop="adsorptionParamA">
                    <el-input 
                      oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.adsorptionParamA" placeholder="请输入"></el-input>
                  </el-form-item>
                </el-col>
                 <el-col :span="8">
                  <el-form-item label="煤层倾向长度" prop="coalLayerRadialLength">
                    <el-input
                      oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.coalLayerRadialLength" placeholder="请输入">
                      <template #suffix>
                        <span>m</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                                <el-col :span="8">
                  <el-form-item label="吸附常数b" prop="adsorptionParamB">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.adsorptionParamB" placeholder="请输入"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤层走向长度" prop="coalLayerForwardLength">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.coalLayerForwardLength" placeholder="请输入">
                      <template #suffix>
                        <span>m</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的灰分" prop="paramAd">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.paramAd" placeholder="请输入">
                      <template #suffix>
                        <span>%</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤层厚度" prop="coalLayerThickness">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.coalLayerThickness" placeholder="请输入">
                      <template #suffix>
                        <span>m</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的水分" prop="paramMd">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.paramMd" placeholder="请输入">
                      <template #suffix>
                        <span>%</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤壁倾向暴露面数" prop="coalWallRadialExposeNum">
                    <el-input v-model.number="state.formData.coalWallRadialExposeNum" placeholder="请输入">
                      
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的孔隙率" prop="paramPi">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.paramPi" placeholder="请输入">
                      <template #suffix>
                        <span>m³/m³</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤壁走向暴露面数" prop="coalWallForwardExposeNum">
                    <el-input v-model.number="state.formData.coalWallForwardExposeNum" placeholder="请输入">

                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的容量" prop="coalDensity">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.coalDensity" placeholder="请输入">

                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="残余瓦斯人工测试值" prop="remainGasTestValue">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.remainGasTestValue" placeholder="请输入">
                      <template #suffix>
                        <span>MPa</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的种类" prop="coalType">
                    <el-select filterable v-model="state.formData.coalType" placeholder="请选择">
                      <el-option label="低变质" value="1"></el-option>
                      <el-option label="高变质" value="2"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="残余瓦斯压力标值" prop="remainGasPressureValue">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.remainGasPressureValue" placeholder="请输入">
                      <template #suffix>
                        <span>MPa</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="原始瓦斯含量" prop="originalGasAmount">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.originalGasAmount" placeholder="请输入">
                      <template #suffix>
                        <span>m³/t</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="残余瓦斯含量达标值" prop="remainGasAmountStandardValue">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.remainGasAmountStandardValue" placeholder="请输入">
                      <template #suffix>
                        <span>m³/t</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="原始瓦斯压力" prop="originalGasPressure">
                    <el-input
                    oninput="value=value.replace(/[^\d.]/g,'').replace(/^\./g,'').replace(/\.{2,}/g,'.').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
                    v-model="state.formData.originalGasPressure" placeholder="请输入">
                      <template #suffix>
                        <span>MPa</span>
                      </template>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="逻辑对象名称" prop="logicPointId">
                    <el-select filterable v-model="state.formData.logicPointId" placeholder="请选择">
                      <el-option v-for="item in state.stationOutNumList" :key="item" :label="item" :value="item">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </div>
        </template>
        <template #footer>
          <el-button @click="cancel">取消</el-button>
          <el-button type="primary" @click="submitForm">
            确定
          </el-button>
        </template>
      </vxe-modal>
    </teleport>
        <!-- 详情弹框 -->
    <teleport to="body">
      <vxe-modal esc-closable destroy-on-close :lock-view="false" :width="660" :height="auto" v-model="state.detailModal"
        resize :mask="true" showFooter>
        <template #title>
          <div class="w100 h100 fsc mask_title">详情</div>
        </template>
        <template #default>
          <div class="form_box">
            <el-form ref="formDetailRef" :model="state.formData" :rules="state.rules" label-position="top">
              <el-row :gutter="20">
                <el-col :span="8">
                  <el-form-item label="工作面" prop="">
                    <span class="cols9">{{state.formData.workingFaceName}}</span>
                  </el-form-item>
                </el-col>
                   <el-col :span="8">
                  <el-form-item label="评价单元名称" prop="">
                    <span class="cols9">{{state.formData.name}}</span>
                  </el-form-item>
                </el-col>
                              <el-col :span="8">
                  <el-form-item label="评价开始时间" prop="">
                    <span class="cols9">{{state.formData.evaluateStartTime}}</span>
                  </el-form-item>
                </el-col>
                 <el-col :span="8">
                  <el-form-item label="是否突出区域" prop="">
                   <span class="cols9">{{state.formData.highlight === true ? '是' : '否'}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤壁暴露开始时间" prop="">
                     <span class="cols9">{{state.formData.coalWallStartExposeTime}}</span>
                  </el-form-item>
                </el-col>
                 <el-col :span="8">
                  <el-form-item label="吸附常数a" prop="">
                    <span class="cols9">{{state.formData.adsorptionParamA}}</span>
                  </el-form-item>
                </el-col>
                 <el-col :span="8">
                  <el-form-item label="煤层倾向长度" prop="">
                    <span class="cols9">{{state.formData.coalLayerRadialLength}}</span>
                  </el-form-item>
                </el-col>
                                <el-col :span="8">
                  <el-form-item label="吸附常数b" prop="">
                    <span class="cols9">{{state.formData.adsorptionParamB}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤层走向长度" prop="">
                    <span class="cols9">{{state.formData.coalLayerForwardLength}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的灰分" prop="">
                    <span class="cols9">{{state.formData.paramAd}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤层厚度" prop="">
                    <span class="cols9">{{state.formData.coalLayerThickness}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的水分" prop="">
                    <span class="cols9">{{state.formData.paramMd}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤壁倾向暴露面数" prop="">
                    <span class="cols9">{{state.formData.coalWallRadialExposeNum}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的孔隙率" prop="">
                    <span class="cols9">{{state.formData.paramPi}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤壁走向暴露面数" prop="">
                    <span class="cols9">{{state.formData.coalWallForwardExposeNum}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的容量" prop="">
                    <span class="cols9">{{state.formData.coalDensity}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="残余瓦斯人工测试值" prop="">
                    <span class="cols9">{{state.formData.remainGasTestValue}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="煤的种类" prop="">
                    <span class="cols9">{{state.formData.coalType === 1 ? '低变质' : '高变质'}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="残余瓦斯压力标值" prop="">
                    <span class="cols9">{{state.formData.remainGasPressureValue}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="原始瓦斯含量" prop="">
                    <span class="cols9">{{state.formData.originalGasAmount}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="残余瓦斯含量达标值" prop="">
                    <span class="cols9">{{state.formData.remainGasAmountStandardValue}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="原始瓦斯压力" prop="">
                    <span class="cols9">{{state.formData.originalGasPressure}}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="逻辑对象名称" prop="logicPointId">
                    <span class="cols9">{{state.formData.logicPointName}}</span>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </div>
        </template>
      </vxe-modal>
    </teleport>
    <!-- 详情 -->
    <el-drawer v-model="state.drawerShow" direction="rtl" size="40%" close-on-click-modal :modal="true">
      <template #header="{ close, titleId, titleClass }">
        <h4 class="mask_sub_title">
          <svg-icon class-name="search-icon" icon-class="biaotitubiao" /><span>分站类型详情</span></h4>
      </template>
      <p class="drawer_sub_title">
        <span class="sub_title_line">基础信息</span>
      </p>
      <div>
        <el-row :gutter="20"
          style="background: rgba(91, 109, 128, 0.04);display: flex;align-items: center;padding: 20px 0;">
          <el-col :span="8" style="text-align: center;">
            <div class="img_box">
              <img v-if="state.formData.imagePath!=null" :src="state.formData.imagePath" alt="" />
              <img v-else src="@/assets/images/noimg.png" />
            </div>
            <span>{{ state.formData.stationTypeName }}</span>
          </el-col>
          <el-col :span="16">
            <el-row :gutter="20">
              <el-col :span="7">
                <p>分站模式</p>
                <p>{{state.formData.stationModelName}}</p>
              </el-col>
              <el-col :span="9">
                <p>输入口数量/输出口数量</p>
                <p>{{state.formData.stationInNum}}/{{state.formData.stationOutNum}}</p>
              </el-col>
              <el-col :span="8">
                <p>引用数量</p>
                <p>{{state.formData.quoteNum}}</p>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
        <el-row :gutter="20" style="margin-top:10px;">
          <el-col :span="24">
            <p class="drawer_sub_title">
              <span class="sub_title_line">基础信息</span>
            </p>
          </el-col>
          <el-col :span="24">
            <p class="fsc">
              <span class="wn">编号</span>
              <el-input style="width:200px;margin:0 10px;" v-model="state.options1.queryList.stationCode" clearable
                placeholder="请输入">
              </el-input>
              <el-button type="primary" @click="yinyonClick">查询</el-button>
              <el-button type="info" @click="reset">重置</el-button>
            </p>
            <vxe-table :loading="loading" height="340" :data="state.formData.stationBasicDtoList" border="inner">
              <vxe-column type="seq" :width="55" title="序号"></vxe-column>
              <vxe-column v-for="(item,index) in state.options1.tableheads" :field="item.field" :title="item.title"
                :params="{name:item.name}" :width="item.width?item.width:''" :key="index">
              </vxe-column>
              <vxe-column title="操作">
                <template #default="{row}">
                  <el-button type="primary" link size="small" @click="btnClick(row)">跳转分站详情</el-button>
                </template>
              </vxe-column>
            </vxe-table>
          </el-col>
        </el-row>

      </div>
    </el-drawer>
  </div>
</template>
<script setup>
  import list_controller from "@/components/commonCom/list_controllerChoucai";
  import {
    computed,
    onMounted,
    reactive
  } from "vue";
  import {
    ElMessage,
    ElMessageBox
  } from 'element-plus'
  import {
    table_headers
  } from '@/components/commonCom/table_headersChoucai';
  import axios from "@/utils/request"
  import usePagesStore from '@/store/modules/pages'
  import {
    getsubstationmodel,
    fileupload
  } from '@/api/config'
  import useUserStore from "@/store/modules/user";
  const userStore = useUserStore();
  const {
    proxy
  } = getCurrentInstance();
  const store = usePagesStore()
  const router = useRouter();
  let previewHttps =
    import.meta.env.VITE_APP_HTTP
  components: {
    list_controller
  }
  const upload = ref(null)
  let state = reactive({
    options: {
      tableheads: computed(() => table_headers.DrainageWorkingFaceUnitEvaluation),
      queryList: {
        dropdownUrl: '',
        querys: [{
          field: 'workingFaceId',
          title: '工作面名称',
          type: 'select',
          binddata: '',
          options: [],
        }, {
          field: 'name',
          title: '单元名称',
          type: 'input',
          binddata: '',
          options: [],
        }],
        queryMap: new Map([
          ['sensorTypeId', 'safety_pointType'],
          ['deviceTypeId', 'safety_deviceType'],
          ['alarmTypeId', 'alarmType']
        ])
      },
      dataUrl: '/drainage/evaluation/list',
      delUrl: '/drainage/evaluation/delete',
      addUrl: '/drainage/evaluation/insert',
      descUrl: '/drainage/evaluation/id',
      editUrl: '/drainage/evaluation/update',
    },
    // 表单
    detailModal:false,
    gongzuomianSelectData:[],
    addModal: false,
    modalTitle: '新增',
    drawerShow: false,
    formRef: null,
    formData: {},
    rules: {
      workingFaceId: [
        { required: true, message: '请选择工作面', trigger: 'change' },
      ],
      name: [
        { required: true, message: '请输入单元名称', trigger: 'blur' },
      ],
      evaluateStartTime: [
        { required: true, message: '请选择评价开始时间', trigger: 'change' },
      ],
      radioValue: [
        { required: true, message: '请选择是否突出区域', trigger: 'change' },
      ],
      coalWallStartExposeTime: [
        { required: true, message: '请选择煤壁暴露开始时间', trigger: 'change' },
      ],
      adsorptionParamA: [
        { required: true, message: '请输入吸附常数a', trigger: 'blur' },
      ],
      coalLayerRadialLength: [
        { required: true, message: '请输入煤层倾向长度', trigger: 'blur' },
      ],
      adsorptionParamB: [
        { required: true, message: '请输入吸附常数b', trigger: 'blur' },
      ],
      coalLayerForwardLength: [
        { required: true, message: '请输入煤层走向长度', trigger: 'blur' },
      ],
      paramAd: [
        { required: true, message: '请输入煤的灰分', trigger: 'blur' },
      ],
      coalLayerThickness: [
        { required: true, message: '请输入煤层厚度', trigger: 'blur' },
      ],
      paramMd: [
        { required: true, message: '请输入煤的水分', trigger: 'blur' },
      ],
      coalWallRadialExposeNum: [
        { required: true, message: '请输入煤壁倾向暴露面数', trigger: 'blur' },
      ],
      paramPi: [
        { required: true, message: '请输入煤的孔隙率', trigger: 'blur' },
      ],
      coalWallForwardExposeNum: [
        { required: true, message: '请输入煤壁走向暴露面数', trigger: 'blur' },
      ],
      coalDensity: [
        { required: true, message: '请输入煤的容量', trigger: 'blur' },
      ],
      remainGasTestValue: [
        { required: true, message: '请输入残余瓦斯人工测试值', trigger: 'blur' },
      ],
      coalType: [
        { required: true, message: '请选择煤的种类', trigger: 'change' },
      ],
      remainGasPressureValue: [
        { required: true, message: '请输入残余瓦斯压力标值', trigger: 'blur' },
      ],
      originalGasAmount: [
        { required: true, message: '请输入原始瓦斯含量', trigger: 'blur' },
      ],
      remainGasAmountStandardValue: [
        { required: true, message: '请输入残余瓦斯含量达标值', trigger: 'blur' },
      ],
      originalGasPressure: [
        { required: true, message: '请输入原始瓦斯压力', trigger: 'blur' },
      ],
      // logicPointId: [
      //   { required: true, message: '请选择逻辑对象名称', trigger: 'change' },
      // ],
    },
    editId: undefined,
    stationmodelList: [],
    stationInNumList: [],
    stationOutNumList: [],
    options1: {
      tableheads: computed(() => table_headers.quoteStation),
      queryList: {
        autoSearch: true,
        dropdownUrl: '',
        stationCode: '',
        stationTypeId: '',
        querys: [{
          field: 'stationCode',
          title: '编号',
          type: 'input',
          binddata: ''
        }],
        queryMap: new Map([
          ['sensorTypeId', 'safety_pointType'],
          ['deviceTypeId', 'safety_deviceType'],
          ['alarmTypeId', 'alarmType']
        ])
      },
      dataUrl: '/substation/type/quote'
    },
  })
  // 查看按钮
  function lookBtn(row) {
    // state.drawerShow = true
    state.detailModal=true
    axios.post(state.options.descUrl,row.id).then(res => {
      if (res.code == 200) {
        state.formData = res.data
        state.options1.queryList.stationTypeId = res.data.id
      }
    })

  }

  function btnClick(row) {
    router.push({
      path: '/cspz/netConfig/net_pointConfig',
      query: {
        id: row.id,
        stationCode: row.stationCode
      }
    })
  }

  function yinyonClick() {
    axios.post('/substation/type/quote', {
      stationTypeId: state.options1.queryList.stationTypeId,
      stationCode: state.options1.queryList.stationCode
    }).then(res => {
      if (res.code == 200) {
        state.formData.stationBasicDtoList = res.data.list
      }
    })
  }

  function reset() {
    state.options1.queryList.stationCode = ''
    axios.post('/substation/type/quote', {
      stationTypeId: state.options1.queryList.stationTypeId,
      stationCode: state.options1.queryList.stationCode
    }).then(res => {
      if (res.code == 200) {
        state.formData.stationBasicDtoList = res.data.list
      }
    })
  }
  // 新增按钮
  function addBtn(row) {
    state.modalTitle = '新增'
    state.addModal = true
    state.formData = {}
    state.editId = undefined
  }

  function LastStr(str) {
    if (str) {
      let index = str.lastIndexOf("\/");
      str = str.substring(index + 1, str.length);
      return str;
    }
  }
  // 编辑按钮
  function editBtn(row) {
    state.modalTitle = '编辑'
    state.addModal = true
    axios.post(state.options.descUrl,row.id).then(res => {
      if (res.code == 200) {
        state.formData = res.data
        state.formData.highlight==true?state.formData.radioValue="1":state.formData.radioValue="0"
        state.editId = res.data.id
      }
    })
  }

  function deleteBtn(row) {
    let ids = []
    if (row != 'mul') {
      ids = [row.id]
    } else {
      if (store.records.length > 0) {
        ids = store.records.map(item => {
          return item.id
        })
      } else {
        proxy.$modal.msgSuccess('请先勾选所要删除数据!');
      }
    }
    if (ids.length > 0) {
      ElMessageBox.confirm(
          '确定要删除该数据吗?',
          '温馨提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }
        )
        .then(() => {
          axios.post(state.options.delUrl, ids).then(res => {
            if (res.code == 200) {
              proxy.$refs['zujianname'].getData()
              state.addModal = false
              ElMessage({
                type: 'success',
                message: res.msg,
              })
              store.records = []
            }
          })

        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: '删除取消',
          })
        })
    }
  }
  /** 提交按钮 */
  function submitForm() {
    console.log(state.formData,'state.formData')
    proxy.$refs["formRef"].validate(valid => {
      if (valid) {
     state.formData.radioValue=="1"?state.formData.highlight=true:state.formData.highlight=false
        if (state.modalTitle=='编辑') {
          state.formData.id = state.editId
          axios.post(state.options.editUrl, state.formData).then(res => {
            if (res.code == 200) {
              proxy.$refs['zujianname'].getData()
              state.addModal = false
              proxy.$modal.msgSuccess(res.msg);
            }
          })
        } else {
          axios.post(state.options.addUrl, state.formData).then(res => {
            if (res.code == 200) {
              proxy.$refs['zujianname'].getData()
              state.addModal = false
              proxy.$modal.msgSuccess(res.msg);
            }
          })
        }
      }
    })
  }

  function cancel() {
    state.addModal = false
  }

  function getsubstationmodelList() {
    let arr = []
    getsubstationmodel().then(res => {
      state.stationmodelList = res.data
      state.stationmodelList.forEach(item => {
        arr.push({
          value: item.id,
          label: item.stationModelName
        })
        state.options.queryList.querys[1].options = arr
      })
    })
  }

  function stationModelChange(val) {
    state.stationmodelList.forEach(item => {
      if (item.id == val) {
        state.stationInNumList = item.stationInNumList
        state.formData.stationInNum = item.stationInNumList[0]
        state.stationOutNumList = item.stationOutNumList
        state.formData.stationOutNum = item.stationOutNumList[0]
      }

    })
  }
  getsubstationmodelList()
function getSelectDatat(){
  axios.post("/drainage/working-face/list", {}).then((res) => {
    if (res.data.length > 0) {
      state.gongzuomianSelectData = [];
      res.data.forEach((item) => {
        state.gongzuomianSelectData.push({
          label: item.name,
          value: item.id,
        });
      });
      state.options.queryList.querys[0].options = state.gongzuomianSelectData;
    }
  });
}
  onMounted(() => {
    getSelectDatat()
  })
</script>
<style lang="scss" scoped>
  ::v-deep .el-drawer {
    .querycss {
      .fsc {
        &:nth-child(2) {
          display: none;
        }
      }
    }

    .table_box {
      .fsc {
        display: none;
      }
    }
  }
  .cols9{
    color: #999;
  }
</style>